package com.gopay.common.cps.dao.cbrmb.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.cbrmb.CbRmbRemitPersonDao;
import com.gopay.common.domain.cbrmb.remitperson.CbRmbRemitPerson;

@Repository(value = "cbRmbRemitPersonDao")
public class CbRmbRemitPersonDaoImpl extends BaseDAOImpl<CbRmbRemitPerson, Serializable>
        implements CbRmbRemitPersonDao {

    @Override
    public boolean checkWhiteList(String corpName) {
        DetachedCriteria criteria = DetachedCriteria.forClass(CbRmbRemitPerson.class);
        criteria.add(Restrictions.eq("isDelete", "0"));
        criteria.add(Restrictions.eq("companyName", corpName));
        List<CbRmbRemitPerson> cbRmbRemitPersonList = findByCriteria(criteria);
        if (null != cbRmbRemitPersonList && cbRmbRemitPersonList.size() > 0) {
            return true;
        } else {
            return false;
        }
    }

}
